﻿namespace SwyishChess.Utility
{
    /// <summary>
    /// Converts the coordinate used in the program to official chess coordinates
    /// </summary>
    public static class CoordinateConverter
    {
        /// <summary>
        /// Covnerts the column
        /// </summary>
        /// <param name="column">Column to convert</param>
        /// <returns>official chess column name</returns>
        public static char ConvertColumn(int column)
        {
            switch (column)
            {
                case 0:
                    return 'a';
                case 1:
                    return 'b';
                case 2:
                    return 'c';
                case 3:
                    return 'd';
                case 4:
                    return 'e';
                case 5:
                    return 'f';
                case 6:
                    return 'g';
                case 7:
                    return 'h';
                default:
                    return '0';
            }
        }

        /// <summary>
        /// Converts row
        /// </summary>
        /// <param name="row">Row to convert</param>
        /// <returns>Official chess row name</returns>
        public static char ConvertRow(int row)
        {
            switch (row)
            {
                case 0:
                    return '8';
                case 1:
                    return '7';
                case 2:
                    return '6';
                case 3:
                    return '5';
                case 4:
                    return '4';
                case 5:
                    return '3';
                case 6:
                    return '2';
                case 7:
                    return '1';
                default:
                    return '0';
            }
        }
    }
}
